from django.db import models

'''
- 问题Question：问题id、问题内容、发布时间
- 选项Choice：选项id、选项内容、选项票数、问题id
'''
#创建实体类，必须继承与models.Model
class Question(models.Model):
    question_text = models.CharField(max_length=200)
    release_time = models.DateTimeField()

    def __str__(self):
        return "问题：%s"%self.question_text
    
    

class Choice(models.Model):
    choice_text = models.CharField(max_length=200)
    vote = models.IntegerField(default=0)
    question = models.ForeignKey(Question)

    def __str__(self):
        return "%s:%s"%(self.question,self.choice_text)
    
